<%@ page import="edu.uow.devdocs.Issue" %>

<table class="searchable tableForm boxSilver">
  <tr>
    <td class="fieldcontain ${hasErrors(bean: issueInstance, field: 'description', 'error')}"><label for="description"><g:message code="issue.description.label" default="Name" /></label></td>
    <td class="fieldcontain ${hasErrors(bean: issueInstance, field: 'description', 'error')}"><g:textField name="description" maxlength="255" value="${issueInstance?.description}"/></td>
    <td class="fieldcontain ${hasErrors(bean: issueInstance, field: 'priority', 'error')} required"><label for="priority"><g:message code="issue.priority.label" default="Priority" /> <span class="required-indicator">*</span></label></td>
    <td class="fieldcontain ${hasErrors(bean: issueInstance, field: 'priority', 'error')} required"><g:select name="priority" from="${1..5}" class="range" value="${fieldValue(bean: issueInstance, field: 'priority')}"/></td>
  </tr>
  <tr>
    <td class="fieldcontain ${hasErrors(bean: issueInstance, field: 'estimatedHours', 'error')}"><label for="estimatedHours"><g:message code="issue.estimatedHours.label" default="Estimated Hours" /></label></td>
    <td class="fieldcontain ${hasErrors(bean: issueInstance, field: 'estimatedHours', 'error')}"><g:field type="number" name="estimatedHours" value="${fieldValue(bean: issueInstance, field: 'estimatedHours')}"/></td>
    <td class="fieldcontain ${hasErrors(bean: issueInstance, field: 'deployment', 'error')}"><label for="deployment"><g:message code="issue.deployment.label" default="Deployment Related Issue" /></label></td>
    <td class="fieldcontain ${hasErrors(bean: issueInstance, field: 'deployment', 'error')}"><g:select id="deployment" name="deployment.id" from="${edu.uow.devdocs.Deployment.active.list()}" optionKey="id" value="${issueInstance?.deployment?.id}" class="many-to-one" noSelection="['null': '']"/></td>
  </tr>
  <tr>
    <td class="fieldcontain ${hasErrors(bean: issueInstance, field: 'referenceNumber', 'error')}"><label for="referenceNumber"><g:message code="issue.referenceNumber.label" default="Reference Number" /></label></td>
    <td class="fieldcontain ${hasErrors(bean: issueInstance, field: 'referenceNumber', 'error')}"><g:textField name="referenceNumber" maxlength="20" value="${issueInstance?.referenceNumber}"/></td>
    <td class="fieldcontain ${hasErrors(bean: issueInstance, field: 'project', 'error')} required"><label for="project"><g:message code="issue.project.label" default="Project" /> <span class="required-indicator">*</span></label></td>
    <td class="fieldcontain ${hasErrors(bean: issueInstance, field: 'project', 'error')} required"><g:select id="project" name="project.id" from="${edu.uow.devdocs.Project.list()}" optionKey="id" value="${issueInstance?.project?.id}" class="many-to-one"/></td>
  </tr>
  <tr>
    <td class="fieldcontain ${hasErrors(bean: issueInstance, field: 'status', 'error')} required"><label for="status"><g:message code="issue.status.label" default="Status" /> <span class="required-indicator">*</span></label></td>
    <td class="fieldcontain ${hasErrors(bean: issueInstance, field: 'status', 'error')} required"><g:select id="status" name="status.id" from="${edu.uow.devdocs.IssueStatus.list()}" optionKey="id" required="" value="${issueInstance?.status?.id}" class="many-to-one"/></td>
    <td class="fieldcontain ${hasErrors(bean: issueInstance, field: 'issueType', 'error')} required"><label for="issueType"><g:message code="issue.issueType.label" default="Issue Type" /> <span class="required-indicator">*</span></label></td>
    <td class="fieldcontain ${hasErrors(bean: issueInstance, field: 'issueType', 'error')} required"><g:select id="issueType" name="issueType.id" from="${edu.uow.devdocs.IssueType.list()}" optionKey="id" required="" value="${issueInstance?.issueType?.id}" class="many-to-one"/></td>
  </tr>
  <tr>
    <td class="fieldcontain ${hasErrors(bean: issueInstance, field: 'person', 'error')} required"><label for="person"><g:message code="issue.person.label" default="Person" /> <span class="required-indicator">*</span></label></td>
    <td class="fieldcontain ${hasErrors(bean: issueInstance, field: 'person', 'error')} required"><g:select id="person" name="person.id" from="${edu.uow.devdocs.Person.list()}" optionKey="id" required="" value="${issueInstance?.person?.id}" class="many-to-one"/></td>
    <td class="fieldcontain ${hasErrors(bean: issueInstance, field: 'downtimeReport', 'error')} required"><label for="downtimeReport"><g:message code="issue.downtimeReport.label" default="Downtime Report" /> <span class="required-indicator">*</span></label></td>
    <td class="fieldcontain ${hasErrors(bean: issueInstance, field: 'downtimeReport', 'error')} required"><g:select id="downtimeReport" name="downtimeReport.id" from="${edu.uow.devdocs.DowntimeReport.list()}" optionKey="id" value="${issueInstance?.downtimeReport?.id}" noSelection="['null': '']" class="many-to-one"/></td>
  </tr>
  <g:if test="${issueInstance?.id}">
    <tr>
    <td></td>
    <td><g:link controller="developmentTask" class="create button" action="create" params="['issue.id':issueInstance.id,'project.id':issueInstance.project.id,'task':issueInstance.description]">${message(code: 'default.button.createNewTask.label', default: 'Add New Task')}</g:link></td>
    <td></td>
    <td><g:link class="resolve button" action="resolve" id="${issueInstance?.id }"><g:message code="default.resolve.label" args="[entityName]" /></g:link></td>
  </tr>
  </g:if>
</table>

<g:if test="${issueInstance?.developmentTasks }">
	<fieldset>
		<h4>Development Tasks</h4>
		<div>
			<ul>
				<g:each in="${issueInstance?.developmentTasks}" var="devTask">
				<li> <g:link controller="developmentTask" action="edit" id="${devTask.id }">${devTask.task} - ${devTask.status }</g:link> </li>
				</g:each>
			</ul>
		</div>
	</fieldset>
</g:if>

<ckeditor:config var="toolbar_Mytoolbar">
[   [ 'Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo' ],
    [ 'Find','Replace','-','SelectAll','-','SpellChecker', 'Scayt' ],
    [ 'Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField' ],
    [ 'Bold','Italic','Underline','Strike','Subscript','Superscript','-','RemoveFormat' ],
    [ 'NumberedList','BulletedList','-','Outdent','Indent','-','Blockquote','CreateDiv','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiLtr','BidiRtl' ],
    [ 'Table','HorizontalRule','Smiley','SpecialChar','PageBreak' ],
    [ 'Styles','Format','Font','FontSize' ],
    [ 'TextColor','BGColor' ],
    [ 'Maximize', 'ShowBlocks','-','About' ]   ]
</ckeditor:config>
<ckeditor:editor name="issue" toolbar="Mytoolbar">
${issueInstance?.issue}
</ckeditor:editor>
